//
//  descriptionTableViewCell.m
//  HYHOME
//
//  Created by cjy on 16/2/29.
//  Copyright © 2016年 Mac. All rights reserved.
//

#import "DescriptionTableViewCell.h"
#import "DKNightVersion.h"
@implementation DescriptionTableViewCell

-(void)dealloc{

    [self.des release];
    [super dealloc];

}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.dk_backgroundColorPicker = DKColorWithRGB(0xffffff, 0x343434);

        self.des = [[UILabel alloc]init];
        [self.contentView addSubview:self.des];
    }
    return self;


}

- (void)layoutSubviews{
    [super layoutSubviews];
    
    self.des.frame = CGRectMake(0, 0, self.contentView.frame.size.width, [[self class]heightForLabel:self.des.text]);
    self.des.font = [UIFont systemFontOfSize:12];
    self.des.numberOfLines = 0;
    self.des.dk_textColorPicker =    DKColorWithRGB(0x343434, 0xb8b8b8);


}

- (void)passModel:(NSString *)model{

    self.des.text = [NSString stringWithFormat:@"            %@",model];



}


+ (CGFloat)heightForLabel:(NSString *)text{
    
    CGRect rect = [text boundingRectWithSize:CGSizeMake([UIScreen mainScreen].bounds.size.width - 40, 0) options: NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12]} context:nil];
    return rect.size.height;
}

+ (CGFloat)heightForCell:(NSString *)model{
    
    CGFloat height =  [DescriptionTableViewCell heightForLabel:model];
    
    
    return height;
    
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
